var firstNameIpt = document.getElementById('first_name');
var emialIpt = document.getElementById('email');
var telephoneIpt = document.getElementById('telephone');

firstNameIpt.onblur = function() {
    var value1 = firstNameIpt.value.trim();
    var reg = /^\w{2,}/;
    if (!reg.test(value1)) {
        this.classList.remove('right')
        firstNameIpt.classList.add('error')
    } else {
        firstNameIpt.classList.remove('error')
        firstNameIpt.classList.add('right')
    }

}

emialIpt.addEventListener('blur', function() {
    var v = this.value;
    var reg = /^\w{2,}@\w+\.\w{2,}/;
    if (!reg.test(v)) {
        this.classList.remove('right')
        this.classList.add('error')
    } else {
        this.classList.remove('error')
        this.classList.add('right')
    }
})

telephoneIpt.addEventListener('blur', function() {
    var v = this.value;
    var reg = /^1[3-9]\d{9}$/;
    if (!reg.test(v)) {
        this.classList.remove('right')
        this.classList.add('error')
    } else {
        this.classList.remove('error')
        this.classList.add('right')
    }
})